/**
 * 调用网页版地图功能
 *
 * 高德
 * https://lbs.amap.com/api/uri-api/guide/mobile-web/point
 *
 * 百度
 * https://lbsyun.baidu.com/index.php?title=uri/api/web
 */

export type MapType = 'gaode' | 'baidu'


export class CallMapFunction {
  /**
   * 单点标注
   * @param lon  经度
   * @param lat 纬度
   * @param name
   * @param type
   */
  static singlePointAnnotation(lon: number | string, lat: number | string, name: string, type: MapType = 'baidu') {
    if (type === 'gaode') {
      window.location.href = `https://uri.amap.com/marker?position=${lon},${lat}&name=${name}&src=mypage&coordinate=gaode&callnative=1`
    } else if (type === 'baidu') {
      window.location.href=
        `http://api.map.baidu.com/marker?location=${lat},${lon}&title=${name}&output=html&src=webapp.baidu.openAPIdemo   `
    }
  }
}
